VC中类里<>的用法 求助
来源:百度知道 编辑:UC知道 时间:2024/06/17 22:51:19
class CSurfacePartition
{
public:
CSurfacePartition();
virtual ~CSurfacePartition();
public:
void Init(short face_indicies[][9],float verticies[][3],float normals[][3],int TriNum,int VerNum);
void LBG();
private:
gstVector VertexNormal(int VerIndex);
double VectorAngle(gstVector v1, gstVector v2);
double VectorDistance(CVector6D &A,CVector6D &B);
private:
// 指向模型的三角面片、顶点和法向量的二维数组(用指向一维数组的指针实现)
short (*pFaceIndicies)[9];
float (*pVerticies)[3];
float (*pNormals)[3];
int VertexNum; // 模型的顶点个数
int TriNum; // 模型的三角面片个数
// 求顶点的法向量的数据结构
//////////////////////////////////////////////////////////////////////////
//与顶点相邻的另外两个顶点的序号
typedef struct _TwoVerIndex
{
gstVector TriNormal; // 三角面片的法向量
int index1; // 相邻的两个顶点的序号
int index2;
}st_TVI;
//点Vi的相关数据结构
typedef struct _Ver
{
public:
CSurfacePartition();
virtual ~CSurfacePartition();
public:
void Init(short face_indicies[][9],float verticies[][3],float normals[][3],int TriNum,int VerNum);
void LBG();
private:
gstVector VertexNormal(int VerIndex);
double VectorAngle(gstVector v1, gstVector v2);
double VectorDistance(CVector6D &A,CVector6D &B);
private:
// 指向模型的三角面片、顶点和法向量的二维数组(用指向一维数组的指针实现)
short (*pFaceIndicies)[9];
float (*pVerticies)[3];
float (*pNormals)[3];
int VertexNum; // 模型的顶点个数
int TriNum; // 模型的三角面片个数
// 求顶点的法向量的数据结构
//////////////////////////////////////////////////////////////////////////
//与顶点相邻的另外两个顶点的序号
typedef struct _TwoVerIndex
{
gstVector TriNormal; // 三角面片的法向量
int index1; // 相邻的两个顶点的序号
int index2;
}st_TVI;
//点Vi的相关数据结构
typedef struct _Ver
<>是泛型,就是X中保存的数据类型为VertexRelatedInfo;下面的内容是个人的理解,不一定严格,要看严格的定义,自己上网查“泛型”关键字。
如果你定义了vector<int> Y;那么从整体来看Y是一个Vector,可以用vector的基本操作方法来进行操作,而具体Y中的每一个元素的类型是int型,当你对Y进行添加数据/取出数据时,必须传入int/或者得到int型数据。
通过泛型,可以极大的实现代码的通用。尤其是实现数据结构中定义的各种基本操作的时候。例如:在数据结构中定义了堆栈的基本操作,而具体的应用中,堆栈会有不同的的元素类型,如果不采用泛类,我们将根据不同的应用各写一套基本的堆栈操作过程;而使用泛型后,可以将堆栈与具体的元素类型进行分离,写一套通用的泛类堆栈,并实现其方法;而在需要在应用时,说明其元素的类型即可。
<<GTA:VC>里包裹的位置?
哪里有可以用所有<<GTA-VC>>游戏秘笈的侠盗车手版本?(急求!!)
求编程软件<VC>的下载地址
我想买双鞋~<NIKE WHOX VC>
比如vc中vector <>
<<<<<<<谁能告诉我一种实现一个手机用2个卡的产品?>>>>>>>>
用VC++6编程时,按照教材上给的范例,其中的一个包含在<cstdlib>中的std::exit...
用C编的程序里有#include<graphics.h>在VC++中无法运行,该怎么办啊,急死啦明天就要用了!
<GTA:VC>中怎么得到飞机?
为什么我的VC++程序在运行头文件#inlcude<graphics>总是出现找不到这个文件的提示?